/**
 * ...
 * @author Krzysztof Rozalski
 */

package hapi.math;

class Displacment2D {

	public var from(default, null):Vector2D;
	public var to(default, null):Vector2D;
	public var displacmentVector(getDiplacmentVector, never):Vector2D;
	public var direction(getDirection, never):Vector2D;
	
	public function new(from, to) {
		this.from = to;
		this.to = to;
	}
	
	public static function createFromCoords(fromX, fromY, toX, toY):Displacment2D {
		return new Displacment2D(new Vector2D(fromX, fromY), new Vector2D(toX, toY));
	}
	
	function getDirection():Vector2D {
		return displacmentVector.normalize();
	}
	
	function getDiplacmentVector():Vector2D {
		return to.minusNew(from);
	}
}